package club.xinghe.servlet.admin;

import club.xinghe.biz.StudentBiz;
import club.xinghe.entity.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/ShowStudentServlet")
public class ShowStudentServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        StudentBiz studentBiz=new StudentBiz ();
        List<Student> studentList=studentBiz.showUser ();

        if(studentList!=null){
            request.setAttribute ( "studentList",studentList);
            request.getRequestDispatcher ( "/admin/showStudent.jsp" ).forward ( request,response );
        }

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost ( request,response );
    }
}
